# cython: language_level=3
import asyncio
import os
import sys
import tracemalloc

sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.redis_client import RedisClient

tracemalloc.start()

async def main():
    host = os.getenv("REDIS_HOST", "localhost")
    port = os.getenv("REDIS_HOST", "6379")
    redis_client = RedisClient("redis://" + host + ":" + port)
    await redis_client.connect()

    # 执行Redis操作
    val = await redis_client.get("test")
    print(val)

    # await redis_client.set('test', '0')

    await redis_client.incrby("test", 1)

    val = await redis_client.get("test")
    print(val)

    # 关闭Redis连接
    await redis_client.disconnect()


if __name__ == "__main__":
    asyncio.run(main())
